/*
大结算界面(该房间游戏结束)，单个玩家信息控件的处理逻辑
*/
var confige = require("confige");
cc.Class({
    extends: cc.Component,

    properties: {
    },

    onLoad: function () {

    },
    
    onInit: function(){
        this.playerNick = this.node.getChildByName("playerNick").getComponent("cc.Label");
        this.playerId = this.node.getChildByName("playerId").getComponent("cc.Label");
        this.bankerCount = this.node.getChildByName("bankerCount").getComponent("cc.Label");
        this.head = this.node.getChildByName("head").getComponent("cc.Sprite");
        this.scoreWNode = this.node.getChildByName("scoreNumW");
        this.scoreLNode = this.node.getChildByName("scoreNumL");
        this.scoreW = this.scoreWNode.getComponent("cc.Label");
        this.scoreL = this.scoreLNode.getComponent("cc.Label");
    },
    
    setHead:function(url){
        window.DKTools.setFrameWithUrl(url,this.head);
    },

    setName:function(str){
        this.playerNick.string = str;
    },

    setID:function(str){
        this.playerId.string = str;
    },

    setBankerCount:function(str){
        this.bankerCount.string = str;
    },

    setScore:function(score){
        var curScore = score;
        if(parseInt(score) < 0)
        {
            this.scoreLNode.active = true;
            this.scoreWNode.active = false;
            this.scoreL.string = Math.round(parseInt(score));;
        }else{
            this.scoreWNode.active = true;
            this.scoreLNode.active = false;
            this.scoreW.string = "/" + Math.round(parseInt(score));;
        }
    },

    setBankerCount:function(str){
        this.bankerCount.string = str;
    },
});
